<!-- eslint-disable vue/valid-v-slot -->
<template>
  <div class="main-container">
    <div class="containBox">
      <div class="tabelLeft">
        <div class="tabTitle">
          <span class="title">注销分类</span>
          <div class="btns">
            <a-button style="padding: 0px 4px" type="text" size="small" @click="addClass"
              >新建</a-button
            >
            <a-button style="padding: 0px 4px" type="text" @click="showClassList" size="small"
              >设置</a-button
            >
          </div>
        </div>
        <div class="tagList">
          <div
            class="activeTag"
            v-for="(item, index) of typeClass"
            :key="index"
            @click="changeTagType(item)"
          >
            <span
              class="actives"
              @contextmenu.prevent.stop="onContextMenu(item, $event)"
              v-if="activeTypeId == item.id"
            >
              <span class="wraps" style="display: flex; align-items: center">
                <img
                  style="width: 20px; height: 20px; margin-left: 10px"
                  src="@/assets/zhu.png"
                  alt=""
                />
                <span
                  style="
                    display: inline-block;
                    max-width: 214px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    padding-left: 10px;
                  "
                  >{{ item.name }}</span
                >
                <!-- <span
                  style="
                    display: inline-block;
                    max-width: 56px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    padding-right: 10px;
                  "
                  >({{ item.cardNumber }}张)</span
                > -->
              </span>
            </span>
            <span class="noactive" @contextmenu.prevent.stop="onContextMenu(item, $event)" v-else>
              <span class="wraps" style="display: flex; align-items: center">
                <img
                  style="width: 20px; height: 20px; margin-left: 10px"
                  src="@/assets/zhu.png"
                  alt=""
                />
                <span
                  style="
                    display: inline-block;
                    max-width: 200px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    padding-left: 10px;
                  "
                  >{{ item.name }}</span
                >
                <!-- <span
                  style="
                    display: inline-block;
                    max-width: 56px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    padding-right: 10px;
                  "
                  >({{ item.cardNumber }}张)</span
                > -->
              </span></span
            >
          </div>
        </div>
      </div>
      <div style="width: calc(100% - 200px)">
        <!-- <div
          style="padding: 20px 0px 0px; box-sizing: border-box; text-align: center; font-size: 18px"
        >
          {{ activeTitle }}
        </div> -->
        <div style="width: 100%; padding: 20px; padding-bottom: 0px">
          <a-form ref="serchForm" :model="form" :style="{ width: '100%' }">
            <a-space :size="20">
              <a-form-item field="card" hide-label>
                <a-input v-model="form.card" placeholder="请输入卡号" allow-clear>
                  <!-- <template #suffix>
                      <icon-plus @click="cardsVisible = true" style="cursor: pointer" />
                    </template> -->
                </a-input>
              </a-form-item>

              <a-form-item field="state" hide-label>
                <a-select v-model="form.state" placeholder="请选择卡板状态" allow-clear>
                  <a-option
                    v-for="(item, index) in useCommon.state"
                    :key="index"
                    :value="item.state"
                    >{{ item.name }}</a-option
                  >
                </a-select>
              </a-form-item>

              <!-- <a-col :span="4">
                <a-form-item field="pay" hide-label>
                  <a-select v-model="form.pay" placeholder="请选择充值状态" allow-clear>
                    <a-option :value="0">未充值</a-option>
                    <a-option :value="1">已充值</a-option>
                  </a-select>
                </a-form-item>
              </a-col> -->

              <a-form-item field="channelId" hide-label>
                <a-select
                  v-model="form.channelId"
                  placeholder="请选择渠道"
                  allow-clear
                  allow-search
                >
                  <a-option v-for="(item, index) in channel" :key="index" :value="item.id">{{
                    item.name
                  }}</a-option>
                </a-select>
              </a-form-item>

              <a-form-item field="seriesId" hide-label>
                <a-select v-model="form.seriesId" placeholder="请选择系列" allow-clear allow-search>
                  <a-option v-for="(item, index) in series" :key="index" :value="item.id">{{
                    item.name
                  }}</a-option>
                </a-select>
              </a-form-item>

              <!-- <a-col :span="4">
                <a-form-item field="seriesId" hide-label>
                  <a-select
                    v-model="form.cancellationGroupId"
                    placeholder="请选择注销分类"
                    allow-clear
                    allow-search
                  >
                    <a-option v-for="(item, index) in typeClass" :key="index" :value="item.id">{{
                      item.name
                    }}</a-option>
                  </a-select>
                </a-form-item>
              </a-col> -->
              <!-- <a-col :span="4">
                  <a-form-item field="state" hide-label>
                    <a-select v-model="form.close" placeholder="请选择方案状态" allow-clear>
                      <a-option value="0">正常</a-option>
                      <a-option value="1">关闭</a-option>
                    </a-select>
                  </a-form-item>
                </a-col> -->

              <a-form-item field="addCancellationTime" hide-label>
                <a-date-picker
                  style="width: 100%"
                  v-model="form.addCancellationTime"
                  show-time
                  placeholder="请选择开始注销时间"
                  :time-picker-props="{ defaultValue: '12:00:00' }"
                  :shortcuts="[
                    {
                      label: '今日',
                      value: () => (
                        (form.addCancellationTime = $dayjs('00:00:00', 'HH:mm:ss').format(
                          'YYYY-MM-DD HH:mm:ss'
                        )),
                        (form.endCancellationTime = $dayjs('23:59:59', 'HH:mm:ss').format(
                          'YYYY-MM-DD HH:mm:ss'
                        ))
                      ),
                    },
                    {
                      label: '昨日',
                      value: () => (
                        (form.addCancellationTime = $dayjs('00:00:00', 'HH:mm:ss')
                          .subtract(1, 'day')
                          .format('YYYY-MM-DD HH:mm:ss')),
                        (form.endCancellationTime = $dayjs('23:59:59', 'HH:mm:ss')
                          .subtract(1, 'day')
                          .format('YYYY-MM-DD HH:mm:ss'))
                      ),
                    },
                    {
                      label: '七日',
                      value: () => (
                        (form.addCancellationTime = $dayjs('00:00:00', 'HH:mm:ss')
                          .subtract(7, 'day')
                          .format('YYYY-MM-DD HH:mm:ss')),
                        (form.endCancellationTime = $dayjs('23:59:59', 'HH:mm:ss')
                          .subtract(1, 'day')
                          .format('YYYY-MM-DD HH:mm:ss'))
                      ),
                    },
                    {
                      label: '本月',
                      value: () => (
                        (form.addCancellationTime = $dayjs('01 00:00:00', 'DD HH:mm:ss').format(
                          'YYYY-MM-DD HH:mm:ss'
                        )),
                        (form.endCancellationTime = $dayjs().format('YYYY-MM-DD HH:mm:ss'))
                      ),
                    },
                    {
                      label: '上月',
                      value: () => (
                        (form.addCancellationTime = $dayjs(`01 00:00:00`, 'DD HH:mm:ss')
                          .subtract(1, 'month')
                          .format('YYYY-MM-DD HH:mm:ss')),
                        (form.endCancellationTime = $dayjs()
                          .subtract(1, 'month')
                          .endOf('month')
                          .format('YYYY-MM-DD HH:mm:ss'))
                      ),
                    },
                  ]"
                  format="YYYY-MM-DD HH:mm:ss"
                  allow-clear
                />
              </a-form-item>
            </a-space>

            <a-space>
              <a-form-item style="width: calc(100% - 15px)" field="endCancellationTime" hide-label>
                <a-date-picker
                  style="width: 100%"
                  v-model="form.endCancellationTime"
                  show-time
                  placeholder="请选择结束注销时间"
                  :time-picker-props="{ defaultValue: '12:00:00' }"
                  :shortcuts="[
                    {
                      label: '今日',
                      value: () => (
                        (form.addCancellationTime = $dayjs('00:00:00', 'HH:mm:ss').format(
                          'YYYY-MM-DD HH:mm:ss'
                        )),
                        (form.endCancellationTime = $dayjs('23:59:59', 'HH:mm:ss').format(
                          'YYYY-MM-DD HH:mm:ss'
                        ))
                      ),
                    },
                    {
                      label: '昨日',
                      value: () => (
                        (form.addCancellationTime = $dayjs('00:00:00', 'HH:mm:ss')
                          .subtract(1, 'day')
                          .format('YYYY-MM-DD HH:mm:ss')),
                        (form.endCancellationTime = $dayjs('23:59:59', 'HH:mm:ss')
                          .subtract(1, 'day')
                          .format('YYYY-MM-DD HH:mm:ss'))
                      ),
                    },
                    {
                      label: '七日',
                      value: () => (
                        (form.addCancellationTime = $dayjs('00:00:00', 'HH:mm:ss')
                          .subtract(7, 'day')
                          .format('YYYY-MM-DD HH:mm:ss')),
                        (form.endCancellationTime = $dayjs('23:59:59', 'HH:mm:ss')
                          .subtract(1, 'day')
                          .format('YYYY-MM-DD HH:mm:ss'))
                      ),
                    },
                    {
                      label: '本月',
                      value: () => (
                        (form.addCancellationTime = $dayjs('01 00:00:00', 'DD HH:mm:ss').format(
                          'YYYY-MM-DD HH:mm:ss'
                        )),
                        (form.endCancellationTime = $dayjs().format('YYYY-MM-DD HH:mm:ss'))
                      ),
                    },
                    {
                      label: '上月',
                      value: () => (
                        (form.addCancellationTime = $dayjs(`01 00:00:00`, 'DD HH:mm:ss')
                          .subtract(1, 'month')
                          .format('YYYY-MM-DD HH:mm:ss')),
                        (form.endCancellationTime = $dayjs()
                          .subtract(1, 'month')
                          .endOf('month')
                          .format('YYYY-MM-DD HH:mm:ss'))
                      ),
                    },
                  ]"
                  format="YYYY-MM-DD HH:mm:ss"
                  allow-clear
                />
              </a-form-item>
              <a-form-item hide-label>
                <a-button type="primary" html-type="submit" @click="doRefresh()"
                  ><template #icon>
                    <icon-search />
                  </template>
                  <!-- Use the default slot to avoid extra spaces -->
                  <template #default>搜索</template></a-button
                >
                <a-button @click="resetSeach" style="margin-left: 15px"
                  ><template #icon>
                    <icon-sync theme="outline" size="14" />
                  </template>
                  <!-- Use the default slot to avoid extra spaces -->
                  <template #default>重置</template></a-button
                >
              </a-form-item>
            </a-space>
          </a-form>
        </div>
        <div style="padding: 0 20px">
          <div
            style="
              display: flex;
              justify-content: space-between;
              border-top: 1px solid var(--color-neutral-2);
            "
          >
            <a-space :size="15" style="margin-top: 20px">
              <a-button type="primary" @click="addTypeTags">
                <template #default>添加</template>
              </a-button>
              <a-button type="outline" :loading="loading" @click="exportDepartments">
                <!-- Use the default slot to avoid extra spaces -->
                <template #default>导出</template>
              </a-button>
              <!-- <a-button type="outline" @click="showClassList">
   
              <template #default>注销分类</template>
            </a-button> -->
              <a-button type="outline" @click="showcancelChange">
                <!-- Use the default slot to avoid extra spaces -->
                <template #default>移除卡板</template>
              </a-button>
            </a-space>
            <a-space :size="15" style="margin-top: 20px">
              <TableConfig
                @update-border="onUpdateBorder"
                @update-striped="onUpdateStriped"
                @refresh="doRefresh"
              />
            </a-space>
          </div>
        </div>
        <div style="width: 100%; padding: 20px">
          <a-table
            :loading="tableLoading"
            :bordered="{ wrapper: true, cell: tables.bordered }"
            :stripe="(tables.striped as boolean)"
            :data="table.dataList"
            :pagination="false"
            :row-key="rowKey"
            :row-class-name="rowClassNameFun"
            :scrollbar="{ type: 'track', outerClass: '', outerStyle: '' }"
            :scroll="{ x: 1200 }"
          >
            <template #columns>
              <a-table-column
                v-for="item of tagColumns.list"
                :key="item.key"
                align="left"
                :title="(item.title as string)"
                :width="item.width"
                :data-index="(item.key as string)"
                :fixed="item.fixed"
                :ellipsis="true"
                :tooltip="true"
              >
                <template v-if="item.key === 'total'" #cell="{ record }">
                  <span v-if="record.free >= 0">
                    {{ Math.floor(((record.used + record.free) / 1024) * 100) / 100 }} G</span
                  >
                  <span v-else> 无限</span>
                </template>
                <template v-if="item.key === 'used'" #cell="{ record }">
                  {{ Math.floor((record.used / 1024) * 100) / 100 }} G
                </template>
                <template v-if="item.key === 'free'" #cell="{ record }">
                  <span v-if="record.free >= 0"
                    >{{ Math.floor((record.free / 1024) * 100) / 100 }} G</span
                  >
                  <span v-else>无限</span>
                </template>
                <template v-if="item.key === 'upstreamFlow'" #cell="{ record }">
                  <div v-if="record.upstreamFlow >= 0">
                    {{ Math.floor((record.upstreamFlow / 1024) * 100) / 100 }} G</div
                  >
                  <div v-else> ---</div>
                </template>
                <!-- <template v-if="item.key === 'shutdown'" #cell="{ record }">
                  <a-tag
                    color="red"
                    size="small"
                    v-if="record.cardCancellationGroup.shutdown == true"
                    >开启</a-tag
                  >
                  <a-tag color="blue" size="small" v-else>关闭</a-tag>
                </template> -->
                <template v-else-if="item.key === 'class'" #cell="{ record }">
                  <span>{{ record.cardCancellationGroup.name }}</span>
                </template>
                <template v-else-if="item.key === 'channel'" #cell="{ record }">
                  {{ record.series.channel.name }}
                </template>
                <template v-else-if="item.key === 'actions'" #cell="{ record }">
                  <a-space :size="2">
                    <!-- <a-button
                      style="padding: 0px 4px"
                      type="text"
                      size="small"
                      @click="updateTags(record)"
                      >刷新</a-button
                    >
                    <a-button
                      style="padding: 0px 4px"
                      type="text"
                      size="small"
                      @click="delTags(record)"
                      >停机</a-button
                    >
                    <a-button
                      style="padding: 0px 4px"
                      type="text"
                      size="small"
                      @click="delTags(record)"
                      >复机</a-button
                    > -->
                    <a-button
                      style="padding: 0px 4px"
                      type="text"
                      size="small"
                      @click="delOneClass(record)"
                      >移除</a-button
                    >
                  </a-space>
                </template>
              </a-table-column>
            </template>
          </a-table>
          <TableFooter :pagination="pagination" position="center" />
        </div>
      </div>
      <!-- <TableBody style="flex-grow: 1">
        <template #header>
          <TableHeader ref="tableHeaderRef" style="margin-bottom: -20px" :show-filter="false">
            <template #search-content> </template>
          </TableHeader>
        </template> -->
      <!-- <template #table-config>
          
        </template>
        <template #default>
          
        </template>
        <template #footer>
      
        </template>
      </TableBody>-->
    </div>
    <!-- 多卡搜索 -->
    <a-modal
      v-model:visible="cardsVisible"
      @before-close="cardsVisible = false"
      title="多卡搜索"
      width="600px"
      :mask-closable="false"
      title-align="start"
    >
      <a-form :auto-label-width="true" :model="form">
        <a-form-item field="remarks" label="卡号">
          <a-textarea v-model="card" placeholder="请输入卡号，一行一个" allow-clear />
        </a-form-item>
      </a-form>
      <template #footer>
        <a-space>
          <a-button @click="cardsVisible = false">取消</a-button>
          <a-button type="primary" @click="cardsFn">确定</a-button>
        </a-space>
      </template>
    </a-modal>
    <a-modal
      v-model:visible="tagvisible"
      @before-close="handleCancelTag"
      :title="tagTypeTitle"
      width="600px"
      :mask-closable="false"
      title-align="start"
    >
      <a-form ref="userFormTag" :auto-label-width="true" :model="subFormTypes">
        <a-form-item
          label="方案名称"
          field="name"
          :rules="[
            { required: true, message: '方案名称不能为空' },
            { minLength: 1, maxLength: 100, message: '方案名称必须小于100个字符' },
          ]"
          :validate-trigger="['change', 'input']"
        >
          <a-input v-model.trim="subFormTypes.name" placeholder="请输入方案名称" allow-clear />
        </a-form-item>
        <!-- <a-form-item
          label="方案排序"
          field="sort"
          :rules="[{ required: true, message: '方案排序不能为空' }]"
          :validate-trigger="['change', 'input']"
        >
          <a-input-number
            v-model.trim="subFormTypes.sort"
            placeholder="请输入方案排序"
            allow-clear
            hide-button
          />
        </a-form-item> -->
      </a-form>
      <template #footer>
        <a-space>
          <a-button @click="handleCancelTag">取消</a-button>
          <a-button type="primary" @click="handleBeforeOkTag">确定</a-button>
        </a-space>
      </template>
    </a-modal>
    <a-modal
      v-model:visible="shebeivisible"
      @before-close="handleCancelsb"
      title="注销类型"
      width="700px"
      :mask-closable="false"
      title-align="start"
    >
      <!-- <a-space :size="15" style="margin-bottom: 20px">
        <a-button type="primary" @click="addTagsPop">
          <template #icon>
            <icon-plus />
          </template>
          <template #default>新建</template>
        </a-button>
      </a-space> -->
      <a-spin :loading="typesLoading" tip="加载中····" style="width: 100%">
        <a-table
          :bordered="{ wrapper: true, cell: tables.bordered }"
          :stripe="(tables.striped as boolean)"
          :row-class-name="rowClassNameFun"
          :data="typeListsDatas"
          :pagination="false"
          :column-resizable="true"
          :rowKey="rowKey"
          table-layout-fixed
        >
          <template #columns>
            <a-table-column
              v-for="item of tableColumnsTypes.list"
              :key="item.key"
              align="left"
              :width="item.width"
              :title="(item.title as string)"
              :data-index="(item.key as string)"
            >
              <template v-if="item.key === 'actions'" #cell="{ record }">
                <a-space :size="2">
                  <a-button
                    style="padding: 0px 4px"
                    type="text"
                    size="small"
                    @click="updatePopType(record)"
                    >编辑</a-button
                  >

                  <a-button
                    style="padding: 0px 4px"
                    type="text"
                    size="small"
                    status="warning"
                    @click="delLimitTypes(record)"
                    >删除</a-button
                  >
                </a-space>
              </template>
              <template v-else-if="item.key === 'speedLimitTypeId'" #cell="{ record }">
                <span
                  v-for="(items, index) in typeListsDatas"
                  :key="index"
                  v-show="items.id == record.speedLimitTypeId"
                  >{{ items.name }}</span
                >
              </template>
            </a-table-column>
          </template>
        </a-table>
      </a-spin>
      <template #footer>
        <!-- <a-space>
          <a-button @click="handleCancelsb">取消</a-button>
          <a-button type="primary" @click="handleBeforeOkBansb">确定</a-button>
        </a-space> -->
      </template>
    </a-modal>
    <a-modal
      v-model:visible="addtagvisible"
      @before-close="handleCancelTags"
      :title="tagsTitle"
      width="600px"
      :mask-closable="false"
      title-align="start"
    >
      <a-form class="huakaClass" ref="huakaForms" :model="huakaForm" :auto-label-width="true">
        <a-form-item label="添加方式" :content-flex="false" :merge-props="false">
          <a-row :gutter="24">
            <a-col :span="2">
              <a-radio style="margin-top: 10px" v-model="checked1" value="orderly" />
            </a-col>
            <a-col :span="10">
              <a-form-item
                hide-asterisk
                field="addCard"
                validate-trigger="input"
                :rules="[
                  { required: checked1 == 'orderly' ? true : false, message: '请输入开始卡号' },
                ]"
                no-style
              >
                <a-input
                  v-model="huakaForm.addCard"
                  :disabled="checked1 == 'orderly' ? false : true"
                  placeholder="请输入开始卡号"
                  allow-clear
                />
              </a-form-item>
            </a-col>
            <a-col :span="2">
              <div style="height: 1px; background-color: #000; margin-top: 16px"></div>
            </a-col>
            <a-col :span="10">
              <a-form-item
                field="endCard"
                hide-asterisk
                validate-trigger="input"
                :rules="[
                  { required: checked1 == 'orderly' ? true : false, message: '请输入结束卡号' },
                ]"
                no-style
              >
                <a-input
                  v-model="huakaForm.endCard"
                  :disabled="checked1 == 'orderly' ? false : true"
                  placeholder="请输入结束卡号"
                  allow-clear
                />
              </a-form-item>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item
          field="cardMultiline"
          :content-flex="false"
          hide-asterisk
          :merge-props="false"
          :rules="[{ required: checked1 == 'disOrder' ? true : false, message: '卡号不能为空' }]"
          :validate-trigger="['change', 'input']"
        >
          <a-row :gutter="24">
            <a-col :span="2">
              <a-radio style="margin-top: 10px" v-model="checked1" value="disOrder" />
            </a-col>
            <a-col :span="22">
              <a-textarea
                :auto-size="{
                  minRows: 10,
                }"
                v-model="huakaForm.cardMultiline"
                :disabled="checked1 == 'disOrder' ? false : true"
                placeholder="请输入卡号，一行一个"
                allow-clear
              />
            </a-col>
          </a-row>
        </a-form-item>

        <!-- <a-form-item
          field="cancellationGroupId"
          label="注销分类"
          hide-asterisk
          :content-flex="false"
          :merge-props="false"
          :rules="[{ required: true, message: '注销分类不能为空' }]"
          :validate-trigger="['change', 'input']"
        >
          <a-row :gutter="24">
            <a-col :span="2" />
            <a-col :span="22">
              <a-select
                v-model="huakaForm.cancellationGroupId"
                placeholder="请选择注销分类"
                allow-clear
              >
                <a-option v-for="(item, index) in typeClass" :key="index" :value="item.id">{{
                  item.name
                }}</a-option>
              </a-select>
            </a-col>
          </a-row>
        </a-form-item> -->
      </a-form>

      <template #footer>
        <a-space>
          <a-button :loading="loading1" @click="handleBeforeOkaddCheck">检测</a-button>
          <a-button type="primary" @click="handleBeforeOkhuaka">确定</a-button>
        </a-space>
      </template>
    </a-modal>
    <a-modal
      v-model:visible="fenleivisible"
      @before-close="fenleivisible = false"
      title="设置分类"
      width="700px"
      :mask-closable="false"
      title-align="start"
    >
      <a-space :size="15" style="margin-bottom: 20px">
        <a-button type="primary" @click="addClass">
          <template #icon>
            <icon-plus />
          </template>
          <template #default>新建</template>
        </a-button>
      </a-space>
      <a-spin :loading="classLoading" tip="加载中····" style="width: 100%">
        <a-table
          :bordered="{ wrapper: true, cell: tables.bordered }"
          :stripe="(tables.striped as boolean)"
          :row-class-name="rowClassNameFun"
          :data="typeClass"
          :pagination="false"
          :column-resizable="true"
          :rowKey="rowKey"
          table-layout-fixed
        >
          <template #columns>
            <a-table-column
              v-for="item of tableColumnsClass.list"
              :key="item.key"
              align="left"
              :width="item.width"
              :title="(item.title as string)"
              :data-index="(item.key as string)"
            >
              <template v-if="item.key === 'actions'" #cell="{ record }">
                <a-space :size="2">
                  <a-button
                    style="padding: 0px 4px"
                    type="text"
                    size="small"
                    :key="record"
                    @click="updateClass(record)"
                    >编辑</a-button
                  >
                  <a-button
                    style="padding: 0px 4px"
                    type="text"
                    size="small"
                    status="warning"
                    @click="delCancelClasss(record)"
                    >删除</a-button
                  >
                </a-space>
              </template>
              <template v-else-if="item.key === 'speedLimitTypeId'" #cell="{ record }">
                <span
                  v-for="(items, index) in typeListsDatas"
                  :key="index"
                  v-show="items.id == record.speedLimitTypeId"
                  >{{ items.name }}</span
                >
              </template>
            </a-table-column>
          </template>
        </a-table>
      </a-spin>
      <template #footer>
        <!-- <a-space>
          <a-button @click="handleCancelsb">取消</a-button>
          <a-button type="primary" @click="handleBeforeOkBansb">确定</a-button>
        </a-space> -->
      </template>
    </a-modal>
    <a-modal
      v-model:visible="addClassPop"
      @before-close="handleCancelClass"
      :title="classTitle"
      width="600px"
      :mask-closable="false"
      title-align="start"
    >
      <a-form ref="subAdds" :auto-label-width="true" :model="subFormClass">
        <a-form-item
          label="分类名称"
          field="name"
          :rules="[
            { required: true, message: '分类名称不能为空' },
            { minLength: 1, maxLength: 100, message: '分类名称必须小于100个字符' },
          ]"
          :validate-trigger="['change', 'input']"
        >
          <a-input v-model.trim="subFormClass.name" placeholder="请输入分类名称" allow-clear />
        </a-form-item>
        <a-form-item
          label="注销提示"
          field="tips"
          :rules="[{ required: true, message: '注销提示不能为空' }]"
          :validate-trigger="['change', 'input']"
        >
          <a-card :body-style="{ padding: '0px' }">
            <RichTextEditor v-if="addClassPop" v-model="subFormClass.tips" ref="richTextEditor" />
          </a-card>
        </a-form-item>
        <!-- <a-form-item field="shutdown" label="强制停机">
          <a-radio-group class="radio-bcg" v-model="subFormClass.shutdown">
            <a-radio :value="true">
              <template #radio="{ checked }">
                <div style="display: flex" :class="{ 'custom-radio-card-checked': checked }">
                  <div className="custom-radio-card-mask">
                    <div className="custom-radio-card-mask-dot"></div> </div
                  ><div className="custom-radio-card-title">开启</div>
                </div>
              </template>
            </a-radio>
            <a-radio :value="false">
              <template #radio="{ checked }">
                <div style="display: flex" :class="{ 'custom-radio-card-checked': checked }">
                  <div className="custom-radio-card-mask">
                    <div className="custom-radio-card-mask-dot"></div> </div
                  ><div className="custom-radio-card-title">关闭</div>
                </div>
              </template>
            </a-radio>
          </a-radio-group>
        </a-form-item> -->
      </a-form>
      <template #footer>
        <a-space>
          <a-button @click="handleCancelClass">取消</a-button>
          <a-button type="primary" @click="handleBeforeOkAddClass">确定</a-button>
        </a-space>
      </template>
    </a-modal>
    <a-modal
      v-model:visible="showCancelPop"
      @before-close="handleCancelCancel"
      title="移除卡板"
      width="600px"
      :mask-closable="false"
      title-align="start"
    >
      <a-form class="huakaClass" ref="cancelForms" :model="cancelForm" :auto-label-width="true">
        <a-form-item label="移除方式" :content-flex="false" :merge-props="false">
          <a-row :gutter="24">
            <a-col :span="2">
              <a-radio style="margin-top: 10px" v-model="checked1" value="orderly" />
            </a-col>
            <a-col :span="10">
              <a-form-item
                hide-asterisk
                field="addCard"
                validate-trigger="input"
                :rules="[
                  { required: checked1 == 'orderly' ? true : false, message: '请输入开始卡号' },
                ]"
                no-style
              >
                <a-input
                  v-model="cancelForm.addCard"
                  :disabled="checked1 == 'orderly' ? false : true"
                  placeholder="请输入开始卡号"
                  allow-clear
                />
              </a-form-item>
            </a-col>
            <a-col :span="2">
              <div style="height: 1px; background-color: #000; margin-top: 16px"></div>
            </a-col>
            <a-col :span="10">
              <a-form-item
                field="endCard"
                hide-asterisk
                validate-trigger="input"
                :rules="[
                  { required: checked1 == 'orderly' ? true : false, message: '请输入结束卡号' },
                ]"
                no-style
              >
                <a-input
                  v-model="cancelForm.endCard"
                  :disabled="checked1 == 'orderly' ? false : true"
                  placeholder="请输入结束卡号"
                  allow-clear
                />
              </a-form-item>
            </a-col>
          </a-row>
        </a-form-item>
        <a-form-item
          field="cardMultiline"
          :content-flex="false"
          hide-asterisk
          :merge-props="false"
          :rules="[{ required: checked1 == 'disOrder' ? true : false, message: '卡号不能为空' }]"
          :validate-trigger="['change', 'input']"
        >
          <a-row :gutter="24">
            <a-col :span="2">
              <a-radio style="margin-top: 10px" v-model="checked1" value="disOrder" />
            </a-col>
            <a-col :span="22">
              <a-textarea
                :auto-size="{
                  minRows: 10,
                }"
                v-model="cancelForm.cardMultiline"
                :disabled="checked1 == 'disOrder' ? false : true"
                placeholder="请输入卡号，一行一个"
                allow-clear
              />
            </a-col>
          </a-row>
        </a-form-item>
      </a-form>

      <template #footer>
        <a-space>
          <a-button :loading="loading1" @click="handleBeforeOkCancelCheck">检测</a-button>
          <a-button type="primary" @click="handleBeforeOkCancel">确定</a-button>
        </a-space>
      </template>
    </a-modal>
    <!-- 提示弹窗 -->
    <a-modal
      v-model:visible="jiancevisible"
      @before-close="jiancevisible = false"
      title="检测结果"
      width="600px"
      :mask-closable="false"
      title-align="start"
    >
      <p style="text-align: center; font-size: 16px">操作卡号数据： </p>
      <p style="text-align: center; margin-top: 20px; font-size: 16px"
        >总操作卡号：<span style="color: #3491fa">{{ jianceForm.total }}张</span>，可操作卡号：<span
          style="color: #3491fa"
          >{{ jianceForm.success }}张</span
        >，不可操作卡号：<span style="color: #3491fa">{{ jianceForm.error }}张</span></p
      >
      <p v-if="jianceForm.repeats" style="text-align: center; font-size: 16px"
        >重复卡号数据：<span style="color: #3491fa" v-for="item in jianceForm.repeats" :key="item"
          >{{ item }}&nbsp;&nbsp;
        </span>
      </p>
      <p v-if="jianceForm.notExists" style="text-align: center; font-size: 16px"
        >不存在卡号数据：<span style="color: #3491fa" v-for="item in jianceForm.repeats" :key="item"
          >{{ item }}&nbsp;&nbsp;
        </span>
      </p>
    </a-modal>
    <ul v-show="showContextMenu" class="contex-menu-wrapper" :style="contextMenuStyle">
      <li>
        <a-button type="text" @click="updatUserPopTag"> 编辑 </a-button>
      </li>
      <li>
        <a-button status="warning" type="text" @click="delLimitTypes"> 删除 </a-button>
      </li>
    </ul>
  </div>
</template>

<script lang="ts" setup>
  import useCommonStore from '@/store/modules/common'
  import * as http from '@/api/http'
  import {
    getDelCards,
    getCancelType,
    getCancelClass,
    addCancelType,
    updateCancelType,
    exportCancelList,
    delCancelDisorder,
    delCancelOrderly,
    addCancelList,
    getAddClass,
    getupdateClass,
    updateCancelLise,
    delCancleType,
    delCancelClass,
    delCancelOrderlyCheck,
    delCancelDisorderCheck,
    addCancelListCheck,
    updateCancelLiseCheck,
  } from '@/api/url'
  import { usePagination, useRowKey, useTable } from '@/hooks/table'

  import { Form, Message, Modal } from '@arco-design/web-vue'
  import { onMounted, reactive, ref, watch } from 'vue'
  const useCommon = useCommonStore()
  const table = useTable()
  const pagination = usePagination(doRefresh)
  const rowKey = useRowKey('id')
  const btnLoading = ref(false)
  const tagvisible = ref(false)
  const userFormTag = ref<typeof Form>()
  const subAdds = ref<typeof Form>()
  const shebeivisible = ref(false)
  const fenleivisible = ref(false)
  const addtagvisible = ref(false)
  const typesLoading = ref(false)
  const classLoading = ref(false)
  const jiancevisible = ref(false)
  const loading1: any = ref(false)

  const activeTypeId = ref('')
  const activeTitle = ref('')
  const checked1: any = ref('orderly')
  const showContextMenu = ref(false)
  const addClassPop = ref(false)
  const jianceForm: any = ref({
    repeats: [],
    notExists: [],
  })
  const form = reactive({
    card: '',
    state: '',
    pay: '',
    channelId: '',
    seriesId: '',
    cancellationGroupId: '',
    addCancellationTime: '',
    endCancellationTime: '',
  })
  const huakaForms = ref<typeof Form>()
  const huakaForm: any = reactive({
    addCard: '',
    endCard: '',
    userId: '',
    cardMultiline: '',
    cancellationGroupId: '',
  })
  const cancelForms = ref<typeof Form>()
  const cancelForm: any = reactive({
    addCard: '',
    endCard: '',
    cardMultiline: '',
  })
  const cardsVisible = ref(false)
  const card: any = ref('')
  function cardsFn() {
    const arr = card.value.split(/\n/g)
    form.card = arr.toString()
    cardsVisible.value = false
  }
  const serchForm = ref()
  const resetSeach = () => {
    serchForm.value.resetFields()
    doRefresh(1)
  }

  const tagTypeTitle = ref('添加类型')
  const subFormTypes: any = ref({
    name: '',
    sort: '',
  })
  const subFormClass: any = ref({
    name: '',
    // shutdown: true,
    tips: '',
  })
  const tagsTitle = ref('添加卡板')
  const subFormTags: any = ref({
    name: '',
    type: '',
    speedLimitTypeId: '',
  })

  const tagColumns: any = reactive({
    list: [
      {
        title: '卡号',
        key: 'card',
        dataIndex: 'card',
        checked: true,
        width: 240,
      },
      {
        title: '总流量',
        key: 'total',
        dataIndex: 'total',
        checked: true,
        width: 120,
      },
      {
        title: '已用流量',
        key: 'used',
        dataIndex: 'used',
        checked: true,
        width: 120,
      },

      {
        title: '剩余流量',
        key: 'free',
        dataIndex: 'free',
        checked: true,
        width: 120,
      },
      {
        title: '卡板状态',
        key: 'stateName',
        dataIndex: 'stateName',
        checked: true,
        width: 100,
      },
      // {
      //   title: '强制停机',
      //   key: 'shutdown',
      //   dataIndex: 'shutdown',
      //   checked: true,
      //   width: 100,
      // },
      // {
      //   title: '注销分类',
      //   key: 'class',
      //   dataIndex: 'class',
      //   checked: true,
      //   width: 100,
      // },
      {
        title: '所属渠道',
        key: 'channel',
        dataIndex: 'channel',
        checked: true,
        width: 100,
      },
      {
        title: '注销时间',
        key: 'cancellationTime',
        dataIndex: 'cancellationTime',
        checked: true,
        width: 190,
      },
      {
        title: '操作',
        key: 'actions',
        dataIndex: 'actions',
        width: 90,
        align: 'left',
        checked: true,
        fixed: 'right',
      },
    ],
  })
  const tableColumnsClass: any = reactive({
    list: [
      {
        title: '分类名称',
        key: 'name',
        dataIndex: 'name',
        checked: true,
        width: 180,
      },
      {
        title: '注销卡板',
        key: 'cardNumber',
        dataIndex: 'cardNumber',
        checked: true,
        width: 180,
      },
      {
        title: '操作',
        key: 'actions',
        fixed: 'right',
        dataIndex: 'actions',
        width: 180,
        align: 'left',
        checked: true,
      },
    ],
  })
  const tableColumnsTypes: any = reactive({
    list: [
      {
        title: '类型ID',
        key: 'id',
        dataIndex: 'id',
        checked: true,
        width: 180,
      },
      {
        title: '类型名称',
        key: 'name',
        dataIndex: 'name',
        checked: true,
        width: 180,
      },
      {
        title: '操作',
        key: 'actions',
        fixed: 'right',
        dataIndex: 'actions',
        width: 180,
        align: 'left',
        checked: true,
      },
    ],
  })

  const channel: any = ref([])
  const series: any = ref([])
  const contextMenuStyle: any = reactive({
    left: '0',
    top: '0',
  })
  const typeListsDatas: any = ref([])
  const tableLoading = ref(false)
  const tables = reactive({
    tableLoading: false,
    bordered: false,
    striped: false,
    expand: [1],
    isExpand: false,
  })
  function getchannel() {
    useCommon.channels().then((res: any) => {
      channel.value = res.data
    })
  }
  function getseries() {
    useCommon.seriess().then((res: any) => {
      series.value = res.data
    })
  }
  const typeClass: any = ref([])
  function showClassList() {
    fenleivisible.value = true
    getCancelClassList()
  }
  function getCancelClassList(val?: any) {
    classLoading.value = true
    http
      .get({
        url: getCancelClass,
        data: () => {
          return {}
        },
      })
      .then((res) => {
        classLoading.value = false
        if (activeTypeId.value == '') {
          activeTypeId.value = res.data[0].id
        } else {
          activeTypeId.value = activeTypeId.value
        }
        typeClass.value = res.data
        if (!val) {
          activeTitle.value = res.data[0].name
        }
        doRefresh()
      })
  }
  function addClass() {
    subFormClass.value.id = null
    classTitle.value = '添加分类'
    addClassPop.value = true
  }
  function showAddTags() {
    subFormTypes.value = {
      name: '',
      sort: '',
    }
    tagTypeTitle.value = '添加类型'
    tagvisible.value = true
  }
  function changeTagType(value: any) {
    activeTypeId.value = value.id
    activeTitle.value = value.name
    getCancelClassList(1)
    doRefresh()
  }
  const showCancelPop = ref(false)
  const showcancelChange = () => {
    showCancelPop.value = true
  }
  function addTypeTags() {
    tagsTitle.value = '添加卡板'
    addtagvisible.value = true
  }
  function updateTags(item: any) {
    subFormTags.value = JSON.parse(JSON.stringify(item))
  }
  const classTitle = ref('添加分类')
  function updateClass(item: any) {
    classTitle.value = '编辑分类'
    subFormClass.value = JSON.parse(JSON.stringify(item))
    addClassPop.value = true
  }
  function updatePopType(item: any) {
    tagTypeTitle.value = '编辑类型'
    subFormTypes.value = JSON.parse(JSON.stringify(item))
    tagvisible.value = true
  }
  const handleCancelsb = () => {
    shebeivisible.value = false
  }
  function handleCancelTag() {
    userFormTag.value?.resetFields()
    tagvisible.value = false
  }
  function handleCancelClass() {
    subAdds.value?.resetFields()
    addClassPop.value = false
  }
  function handleCancelCancel() {
    cancelForms.value?.resetFields()
    showCancelPop.value = false
  }
  function handleCancelTags() {
    huakaForms.value?.resetFields()
    addtagvisible.value = false
  }
  function showPop() {
    shebeivisible.value = true
  }
  function gettypeList() {
    typesLoading.value = true
    http
      .get({
        url: getCancelType,
        data: () => {
          return {}
        },
      })
      .then((res) => {
        typeListsDatas.value = res.data
        if (activeTypeId.value == '') {
          activeTypeId.value = typeListsDatas.value[0].id
        } else {
          activeTypeId.value = activeTypeId.value
        }

        activeTitle.value = typeListsDatas.value[0].name

        doRefresh()
        getCancelClassList()
        typesLoading.value = false
      })
  }

  function updatUserPopTag() {
    classTitle.value = '编辑分类'
    addClassPop.value = true
  }
  function delLimitTypes(item: any) {
    let delId = ''
    if (item.id) {
      delId = item.id
    } else {
      delId = subFormClass.value.id
    }

    Modal.warning({
      title: '操作确认',
      content: '确定要删除此分类吗？',
      cancelText: '取消',
      titleAlign: 'start',
      hideCancel: false,
      okText: '删除',
      onOk: () => {
        http
          .get({
            url: delCancelClass,
            data: () => {
              return {
                id: delId,
              }
            },
          })
          .then((res) => {
            if (res.code == 0) {
              Message.success(res.msg)
              getCancelClassList()
              if (typeClass.value.length > 0) {
                activeTypeId.value = typeClass.value[0].id
              }
            } else {
              Message.error(res.msg)
            }
          })
          .catch(console.log)
      },
    })
  }
  function delCancelClasss(item: any) {
    Modal.warning({
      title: '操作确认',
      content: '确定要删除此分类吗？',
      cancelText: '取消',
      titleAlign: 'start',
      hideCancel: false,
      okText: '删除',
      onOk: () => {
        http
          .get({
            url: delCancelClass,
            data: () => {
              return {
                id: item.id,
              }
            },
          })
          .then((res) => {
            if (res.code == 0) {
              Message.success(res.msg)
              getCancelClassList()
            } else {
              Message.error(res.msg)
            }
          })
          .catch(console.log)
      },
    })
  }
  function delOneClass(item: any) {
    Modal.warning({
      title: '操作确认',
      content: '确定要移除此卡板吗？',
      cancelText: '取消',
      titleAlign: 'start',
      hideCancel: false,
      okText: '删除',
      onOk: () => {
        http
          .formpost({
            url: delCancelDisorder,
            data: () => {
              return {
                cardMultiline: item.card,
              }
            },
          })
          .then((res) => {
            if (res.code == 0) {
              Message.success('移除成功')
              jianceForm.value = res.data
              doRefresh()
            } else {
              Message.error('移除成功')
            }
          })
          .catch(console.log)
      },
    })
  }
  function delTags(item: any) {
    return false
    Modal.warning({
      title: '操作确认',
      content: '确定要删除此标签吗？',
      cancelText: '取消',
      titleAlign: 'start',
      hideCancel: false,
      okText: '删除',
      onOk: () => {
        http
          .get({
            url: delCancelDisorder,
            data: () => {
              return {
                id: item.id,
              }
            },
          })
          .then((res) => {
            if (res.code == 0) {
              Message.success(res.msg)
              doRefresh()
            } else {
              Message.error(res.msg)
            }
          })
          .catch(console.log)
      },
    })
  }
  const richTextEditor = ref()
  function handleBeforeOkAddClass() {
    subAdds.value?.validate().then((error: any) => {
      if (!error) {
        if (!subFormClass.value.id) {
          http
            .post({
              url: getAddClass,
              data: () => {
                return {
                  ...subFormClass.value,
                }
              },
            })
            .then((res) => {
              btnLoading.value = false
              if (res.code == 0) {
                Message.success(res.msg)
                addClassPop.value = false
                subFormClass.value.id = null
                subAdds.value?.resetFields()
                getCancelClassList()
              } else {
                Message.error(res.msg)
              }
            })
        } else {
          classTitle.value = '编辑卡板'
          http
            .post({
              url: getupdateClass,
              data: () => {
                return {
                  ...subFormClass.value,
                }
              },
            })
            .then((res) => {
              btnLoading.value = false
              if (res.code == 0) {
                Message.success(res.msg)
                addClassPop.value = false
                subFormClass.value.id = null
                subAdds.value?.resetFields()
                getCancelClassList()
              } else {
                Message.error(res.msg)
              }
            })
        }
      }
    })
  }
  const handleBeforeOkaddCheck = () => {
    huakaForms.value?.validate().then((error: any) => {
      if (!error) {
        loading1.value = true
        if (checked1.value == 'disOrder') {
          http
            .formpost({
              url: updateCancelLiseCheck + '?cancellationGroupId=' + activeTypeId.value,
              data: () => {
                return {
                  cardMultiline: huakaForm.cardMultiline,
                }
              },
            })
            .then((res) => {
              if (res.code == 0) {
                Message.success(res.msg)
                loading1.value = false
                jianceForm.value = res.data
                jiancevisible.value = true
              }
            })
            .catch(() => {
              loading1.value = false
            })
        } else {
          http
            .post({
              url: addCancelListCheck + '?cancellationGroupId=' + activeTypeId.value,
              data: () => {
                return {
                  addCard: huakaForm.addCard,
                  endCard: huakaForm.endCard,
                }
              },
            })
            .then((res) => {
              if (res.code == 0) {
                Message.success(res.msg)
                loading1.value = false
                jianceForm.value = res.data
                jiancevisible.value = true
              }
            })
            .catch(() => {
              loading1.value = false
            })
        }
      }
    })
  }
  const handleBeforeOkCancelCheck = () => {
    cancelForms.value?.validate().then((error: any) => {
      if (!error) {
        loading1.value = true
        if (checked1.value == 'disOrder') {
          http
            .formpost({
              url: delCancelDisorderCheck,
              data: () => {
                return {
                  remarks: cancelForm.remarks,
                  cardMultiline: cancelForm.cardMultiline,
                }
              },
            })
            .then((res) => {
              if (res.code == 0) {
                Message.success(res.msg)
                loading1.value = false
                jianceForm.value = res.data
                jiancevisible.value = true
              }
            })
            .catch(() => {
              loading1.value = false
            })
        } else {
          http
            .post({
              url: delCancelOrderlyCheck,
              data: () => {
                return {
                  addCard: cancelForm.addCard,
                  endCard: cancelForm.endCard,
                }
              },
            })
            .then((res) => {
              if (res.code == 0) {
                Message.success(res.msg)
                loading1.value = false
                jianceForm.value = res.data
                jiancevisible.value = true
              }
            })
            .catch(() => {
              loading1.value = false
            })
        }
      }
    })
  }
  const handleBeforeOkCancel = () => {
    cancelForms.value?.validate().then((error: any) => {
      if (!error) {
        if (checked1.value == 'orderly') {
          http
            .post({
              url: delCancelOrderly,
              data: () => {
                return {
                  addCard: cancelForm.addCard,
                  endCard: cancelForm.endCard,
                }
              },
            })
            .then((res) => {
              if (res.code == 0) {
                // Message.success(res.msg)
                cancelForms.value?.resetFields()
                showCancelPop.value = false
                jianceForm.value = res.data
                jiancevisible.value = true
                doRefresh()
              }
            })
        } else {
          http
            .formpost({
              url: delCancelDisorder,
              data: () => {
                return {
                  cardMultiline: cancelForm.cardMultiline,
                }
              },
            })
            .then((res) => {
              if (res.code == 0) {
                cancelForms.value?.resetFields()
                showCancelPop.value = false
                jianceForm.value = res.data
                jiancevisible.value = true
                doRefresh()
              }
            })
        }
      }
    })
  }
  const handleBeforeOkhuaka = () => {
    huakaForms.value?.validate().then((error: any) => {
      if (!error) {
        if (checked1.value == 'orderly') {
          http
            .post({
              url: addCancelList + '?cancellationGroupId=' + activeTypeId.value,
              data: () => {
                return {
                  addCard: huakaForm.addCard,
                  endCard: huakaForm.endCard,
                }
              },
            })
            .then((res) => {
              if (res.code == 0) {
                Message.success('添加成功')
                huakaForms.value?.resetFields()
                addtagvisible.value = false
                jianceForm.value = res.data
                jiancevisible.value = true
                // gettypeList()
                doRefresh()
              }
            })
        } else {
          http
            .formpost({
              url: updateCancelLise + '?cancellationGroupId=' + activeTypeId.value,
              data: () => {
                return {
                  cardMultiline: huakaForm.cardMultiline,
                }
              },
            })
            .then((res) => {
              if (res.code == 0) {
                Message.success(res.msg)
                huakaForms.value?.resetFields()
                addtagvisible.value = false
                jianceForm.value = res.data
                jiancevisible.value = true
                gettypeList()
                doRefresh()
              }
            })
        }
      }
    })
  }
  function handleBeforeOkTag() {
    userFormTag.value?.validate().then((error: any) => {
      if (!error) {
        if (!subFormTypes.value.id) {
          http
            .post({
              url: addCancelType,
              data: () => {
                return {
                  ...subFormTypes.value,
                }
              },
            })
            .then((res) => {
              btnLoading.value = false
              if (res.code == 0) {
                Message.success(res.msg)
                tagvisible.value = false
                subFormTypes.value.id = null
                userFormTag.value?.resetFields()
                gettypeList()
              } else {
                Message.error(res.msg)
              }
            })
        } else {
          http
            .post({
              url: updateCancelType,
              data: () => {
                return {
                  ...subFormTypes.value,
                }
              },
            })
            .then((res) => {
              btnLoading.value = false
              if (res.code == 0) {
                Message.success(res.msg)
                tagvisible.value = false
                subFormTypes.value.id = null
                userFormTag.value?.resetFields()
                gettypeList()
              } else {
                Message.error(res.msg)
              }
            })
        }
      }
    })
  }

  function closeNext() {
    showContextMenu.value = false
  }
  watch(
    () => showContextMenu.value,
    () => {
      if (showContextMenu.value) {
        document.body.addEventListener('click', closeNext)
      } else {
        document.body.removeEventListener('click', closeNext)
      }
    },
    { deep: true }
  )
  function onContextMenu(item: any, e: MouseEvent) {
    classTitle.value = '编辑分类'
    if (!item.species) {
      item.species = ['']
    }
    subFormClass.value = JSON.parse(JSON.stringify(item))
    const { clientX, clientY } = e
    e.preventDefault()
    contextMenuStyle.left = clientX - 200 + 'px'
    contextMenuStyle.top = clientY - 90 + 'px'
    showContextMenu.value = true
  }
  function doRefresh(value?: number) {
    // eslint-disable-next-line prettier/prettier
    tableLoading.value = true
    if (value) {
      pagination.page = value
    }
    form.cancellationGroupId = activeTypeId.value
    http
      .get({
        url: getDelCards,
        data: () => {
          return {
            page: pagination.page,
            size: pagination.pageSize,
            ...form,
          }
        },
      })
      .then((res) => {
        tableLoading.value = false
        res.data.list.forEach((item: any) => {
          useCommon.state.forEach((val: any) => {
            if (val.state == item.state) {
              item.stateName = val.name
            }
          })
        })
        table.handleSuccess(res.data.list)
        pagination.setTotalSize((res.data as any).totalSize)
      })
      .catch(console.log)
  }

  const onUpdateBorder = (isBordered: boolean) => {
    tables.bordered = isBordered
  }
  function onUpdateStriped(isStriped: boolean) {
    tables.striped = isStriped
  }
  function rowClassNameFun(_record: any, index: number) {
    return index % 2 === 1 && table.striped.value ? 'table-striped' : null
  }
  const loading = ref(false)
  const exportDepartments = () => {
    loading.value = true
    form.cancellationGroupId = activeTypeId.value
    useCommon
      .downLoads(exportCancelList, form, '卡板注销')
      .then(() => {
        loading.value = false
      })
      .catch(() => {
        loading.value = false
      })
  }
  onMounted(async () => {
    getCancelClassList()
    await getchannel()
    await getseries()
  })
</script>

<style lang="less" scoped>
  .arco-form .arco-space {
    :deep(.arco-space-item) {
      width: 20% !important;
    }
  }
  .form-item-20 {
    width: calc(20% - 15px);
  }
  .containBox {
    width: 100%;
    display: flex;
    background-color: var(--color-bg-1);
    border-radius: 10px;

    .tabelLeft {
      width: 254px;
      min-height: 100%;
      padding: 20px;
      box-sizing: border-box;
      border-right: 1px solid var(--color-neutral-2);

      .tabTitle {
        display: flex;
        justify-content: space-between;
        align-items: center;

        .title {
          color: rgb(var(--gray-10));
          font-size: 18px;
        }

        .btns {
          display: flex;
          justify-content: space-between;
          align-items: center;
        }
      }

      .tagList {
        width: 214px;
        margin-top: 20px;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;

        .activeTag {
          width: 100%;
          height: 45px;
          font-size: 14px;
          margin-bottom: 5px;

          .actives {
            display: block;
            cursor: pointer;
            width: 100%;
            height: 100%;
            line-height: 45px;
            background-color: var(--color-neutral-2);
            border-radius: 5px;
          }
          .wraps {
            cursor: pointer;
          }
          .noactive {
            display: block;
            cursor: pointer;
            width: 100%;
            color: rgb(var(--gray-10));
            height: 100%;
            line-height: 45px;
          }
        }
      }
    }
  }

  :deep(.arco-table-cell-expand-icon) {
    justify-content: center;
  }
  .huakaClass :deep(.arco-form-item-message) {
    margin-left: 42px !important;
  }
  :deep(.arco-tabs-nav-tab) {
    background-color: var(--color-bg-1);
    padding: 20px 0;
    border-radius: 10px;
  }

  :deep(.arco-tabs-content::before) {
    height: 0px !important;
  }

  :deep(.arco-tabs-tab) {
    margin: 0 20px;
    padding: 0;
    padding-bottom: 5px;
  }

  :deep(.arco-tabs-nav::before) {
    position: static !important;
    height: 0px !important;
  }

  :deep(.arco-tabs-content) {
    padding-top: 20px;
  }

  .contex-menu-wrapper {
    position: absolute;
    width: 100px;
    z-index: 999;
    list-style: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
    background-color: var(--color-bg-1);
    padding-left: 0;
    border-radius: 4px;

    & > li {
      width: 100%;
      box-sizing: border-box;
      display: flex;
      align-items: center;
      padding: 0px 0;

      & button {
        width: 100%;
      }
    }

    & > li:hover {
      color: var(--primary-color);
    }
  }

  .top {
    margin-bottom: 20px;
    background-color: var(--color-bg-1);
    border-radius: 10px;

    .box {
      display: flex;
      align-items: center;
      height: 30px;
      margin: 5px 10px;

      .line {
        width: 5px;
        height: 25px;
        margin-right: 10px;
        background-color: #40a1ff;
      }

      .text {
        font-size: 16px;
        line-height: 25px;
        text-align: center;
      }
    }

    .flex {
      display: flex;
      justify-content: space-around;
      margin: 12px 7px;

      .dataBox:last-child {
        margin-right: 0px !important;
      }

      .dataBox {
        display: flex;
        align-items: center;
        justify-content: center;
        align-items: center;
        flex: 1;
        margin-right: 20px;
        height: 150px;
        background-image: linear-gradient(rgb(var(--arcoblue-1)), #fff);
        border: 1px solid #f2f3f5;
        border-radius: 10px;

        .img {
          width: 70px;
          height: 70px;
          margin-right: 20px;
          border-radius: 50%;
        }

        .name {
          margin-top: 0;
        }

        .number {
          font-size: 22px;
        }
      }
    }
  }

  .avatar-container {
    position: relative;
    width: 30px;
    height: 30px;
    margin: 0 auto;
    vertical-align: middle;

    .avatar {
      width: 100%;
      height: 100%;
      border-radius: 50%;
    }

    .avatar-vip {
      border: 2px solid #cece1e;
    }

    .vip {
      position: absolute;
      top: 0;
      right: -9px;
      width: 15px;
      transform: rotate(60deg);
    }
  }

  .gender-container {
    .gender-icon {
      width: 20px;
    }
  }

  .custom-checkbox-card {
    padding: 5px 16px;
    border-radius: 4px;
    width: auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    background-color: var(--color-fill-2);
  }

  .custom-checkbox-card-mask {
    height: 14px;
    width: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    border: 1px solid var(--color-border-2);
    box-sizing: border-box;
  }

  .custom-checkbox-card-mask-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
  }

  .custom-checkbox-card-title {
    color: var(--color-text-1);
    font-size: 14px;
  }

  .custom-checkbox-card:hover,
  .custom-checkbox-card-checked,
  .custom-checkbox-card:hover .custom-checkbox-card-mask,
  .custom-checkbox-card-checked .custom-checkbox-card-mask {
    border-color: rgb(var(--primary-6));
  }

  .custom-checkbox-card:hover .custom-checkbox-card-title,
  .custom-checkbox-card-checked .custom-checkbox-card-title {
    color: rgb(var(--primary-6));
  }

  .custom-checkbox-card-checked .custom-checkbox-card-mask-dot {
    background-color: rgb(var(--primary-6));
  }
  :deep(.arco-table-td-content button) {
    padding: 0px !important;
    margin-right: 8px;
    background: none !important;
  }
</style>
<style scoped>
  .ant-table-striped :deep(.table-striped) td {
    background-color: #fafafa;
  }
</style>
